package org.magnerfuller.imtoolkit.server.service;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * The class BufferedServiceBackend provides a default service backend
 * that uses standard buffered I/O through the familiar BufferedReader
 * and PrintWriter classes. 
 *
 */
public abstract class BufferedServiceBackend extends ServiceBackendAdapter {

  /** reader -- Use this for reading */
  protected BufferedReader reader;
  
  /** writer -- Use this for writing */
  protected PrintWriter writer;
  
  /**
   * Constructor
   * 
   * @throws IOException
   */
  public BufferedServiceBackend() throws IOException {
    super();
    
    reader = new BufferedReader(new InputStreamReader(myInputStream));
    writer = new PrintWriter(myOutputStream);
  }//BufferedServiceBackend

  /**
   * Perform the service-providing functionality here.
   */
  public abstract void run();

}
